#include <iostream>

#include "Omvandla.h"

int main_test( void );


int main( void )
{
	// main_test( void );

	int tal1, tal2;

	cout << "Welcome to DigSim!" << endl;

	cout << "Enter the first integer to compute: ";
	cin >> tal1;
	cout << endl;

	cout << "Enter the second integer to compute: ";
	cin >> tal2;
	cout << endl;

	Bitstr *str1 = new Bitstr();
	Bitstr *str2 = new Bitstr();
	Bitstr *sumstr = new Bitstr();

	tal_str(tal1, str1);
	tal_str(tal2, str2);

	cout << "First integer as binary: ";
	str1->print();
	cout << "Second integer as binary: ";
	str2->print();

	cout << "The two binary numbers are: ";
	str1->addstr(*str2, sumstr);
	sumstr->print();
	cout << "When added together" << endl;

	cout << "Or as integer: " << str_tal(*sumstr) << endl;


	cin.get();
	cin.get();
	return 0;
}

int main_test( void )
{
	Bit a0,b1('1');
	Bit c1('1');


	Bitstr str1;
	Bitstr str2;
	Bitstr *sumstr = new Bitstr();

	str1.push_back(b1);
	str1.push_back(a0);
	str1.push_back(c1);

	str2.push_back(b1);
	str2.push_back(c1);
	str2.push_back(a0);

	str1.addstr(str2, sumstr);

	str1.print();
	str2.print();

	cout << "str1(101) + str2(110) = :";
	sumstr->print();

	int i = 10;
	Bitstr *str3 = new Bitstr();
	tal_str(10, str3);

	cout << i << " In binary is: ";
	str3->print();

	str3->print();
	cout << "In decimal is: " << str_tal( *str3 ) << endl;

	return 0;
}